<?php
/**
 * Created by PhpStorm.
 * User: daimingyue
 * Date: 11/9/17
 * Time: 12:01 AM
 */

namespace App\Http\ViewComposers;

use App\Type;
use Illuminate\View\View;

class SidebarComposer
{
    /**
     * The user repository implementation.
     *
     */
    protected $user;
    protected $types;

    /**
     * Create a new profile composer.
     *
     * @return void
     */
    public function __construct()
    {
        $this->user = auth()->user();
        $this->types = Type::all();
    }

    /**
     * Bind data to the view.
     *
     * @param  View  $view
     * @return void
     */
    public function compose(View $view)
    {
        $view->with('user', $this->user)->with('types', $this->types);
    }
}